package com.example.stringbufferlogger.config;

import java.util.concurrent.atomic.AtomicInteger;

public class TaskStatus {
    /**
     * 任务启动标识
     */
    public static final Integer TASK_RUN = 1;

    /**
     * 任务中止标识
     */
    public static final Integer TASK_STOP = 0;

    /**
     * 配置表CP_CONFIG_ENUMERATION中任务执行状态type
     */
    public static final String TASK_CONFIG_TYPE = "TASK_RUN_FLAG";

    private static final AtomicInteger taskRunStatus = new AtomicInteger(TASK_RUN);

    public static boolean isStop() {
        return taskRunStatus.get() == TASK_STOP;
    }

    public static Boolean setTaskRunStatus(Integer flag) {
        taskRunStatus.set(flag);
        return Boolean.TRUE;
    }
}
